/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.classnet.db;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author karltinawi
 */
@Entity
@Table(name = "actRequest")
@NamedQueries({@NamedQuery(name = "ActRequest.findById", query = "SELECT a FROM ActRequest a WHERE a.id = :id"), @NamedQuery(name = "ActRequest.findByCode", query = "SELECT a FROM ActRequest a WHERE a.code = :code"), @NamedQuery(name = "ActRequest.findByDescription", query = "SELECT a FROM ActRequest a WHERE a.description = :description")})
public class ActRequest implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "id", nullable = false)
    private Integer id;
    @Column(name = "code", nullable = false)
    private int code;
    @Column(name = "description", nullable = false)
    private String description;
    @JoinColumn(name = "user", referencedColumnName = "email")
    @ManyToOne
    private User user;

    public ActRequest() {
    }

    public ActRequest(Integer id) {
        this.id = id;
    }

    public ActRequest(Integer id, int code, String description) {
        this.id = id;
        this.code = code;
        this.description = description;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ActRequest)) {
            return false;
        }
        ActRequest other = (ActRequest) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.classnet.db.ActRequest[id=" + id + "]";
    }

}
